package org.hive.testserver.domain.util;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import org.apache.commons.io.FileUtils;

/**
 * 
 * @author hwng
 *
 */
public class FileUtility extends FileUtils {
	
	public static void appendToFile(File fileName, String contents) throws IOException {
		System.out.println("writing out to fileName " + fileName + " contents: " + contents);
		if (!fileName.exists()) {
			fileName.createNewFile();
		}
		FileWriter writer = new FileWriter(fileName, true);
		BufferedWriter bufferedWriter = new BufferedWriter(writer);
		bufferedWriter.write(contents);
		bufferedWriter.newLine();
		bufferedWriter.close();
	}

}
